package com.yan.controller.service;

import com.epay.ts.sss.wpc.api.WeakPasswordCheckService;
import com.epay.ts.sss.wpc.api.entity.PasswordCheckResult;
import com.epay.ts.sss.wpc.api.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

//@Service
@Controller
public class WpcTestService {
    @Autowired
    private WeakPasswordCheckService weakPasswordCheckService;
    //  @Autowired
    //  private WeakPasswordCheckService weakPasswordCheckService;

    // .........
    @ResponseBody
    @RequestMapping("/date/{name}/{password}")
    public String testCheckPassword(@PathVariable("name") String username, @PathVariable("password") String password) {
        // ......业务逻辑.....
        // WeakPasswordCheckService service = new WeakPasswordCheckService();

        PasswordCheckResult checkResult = weakPasswordCheckService.checkWeakPassword(username, password);
        System.out.println("返回的值是1===>" + checkResult.getResultMsg());//msg
        System.out.println("返回的值是2===>" + checkResult.getResultCode());//code
        System.out.println("返回的值是3===>" + checkResult.toString());
        System.out.println("返回的值是4===>" + checkResult.isSuccess());//是否成功
        System.out.println("返回的值是5===>" + checkResult.getResultCode().equals("SUCCESS"));//是否等于success
        System.out.println("返回的值是6===>" + checkResult.getResultCode());
        if ("SUCCESS".equals(checkResult.getResultCode())) {
            // 密码为弱密码，保存失败.......
            // ....
            System.out.println("密码为强密码验证成功");
        } else {
            System.out.println("密码为弱密码验证失败");
        }
        // .... 业务逻辑....x
        System.out.println("2");


        return "0";
    }
    // .....
    //明文密码的值 8top@14#84QDa88
    public static void main(String[] args) {

//        if (StringUtil.isBlank("5665eqdte+-")){
//            System.out.println("11");
//        }else {
//            System.out.println("22");
//        }

    // WpcTestService.testCheckPassword("root","195+545795");






    }

}